package com.example.javabasic.thread.classtwo.threadlocal.demo1;

public class ThreadLocalComplexTest {
    private static ThreadLocal threadLocal = new ThreadLocal();

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            threadLocal.set("11111");
            System.out.println(Thread.currentThread().getName()+" ->"+threadLocal.get());
        });
        Thread thread1 = new Thread(() -> {
            threadLocal.set("22222");
            System.out.println(Thread.currentThread().getName()+" ->"+threadLocal.get());
        });
        thread.start();
        thread1.start();
        thread.join();
        thread1.join();

        System.out.println(Thread.currentThread().getName()+" ->"+threadLocal.get());
    }

}
